<%@ page language="java" contentType="text/html; charset=utf-8"	pageEncoding="utf-8"%>
<html>
<head>
<script type="text/javascript">
$(document).ready(function () {
// 	$('#pid').combotree({
//         url : '${path }/rest/comboTree.do',
//        // parentField : 'pid',
//         lines : true,
//         panelHeight : 'auto'
//         //value : '${resource.pid}'
//     });
    
})//end ready


function saveMenu() {
	
	//$('#user-fm').birthday 编辑日期表单值，然后提交
    $('#org-fm').form('submit', {
        url: 'rest/orgAdd.do?saveType=1',        						//1增加
        onSubmit: function () {
        	var validator = $(this).form('validate');
        	if(validator){
        		  $.messager.progress();
        	} 
        	return validator; 
        },
        success: function (result) {
        	$.messager.progress('close'); 
            result = eval('(' + result + ')');
            if (result.success=='true') {
            	back('org/index.do'); 
            } else {
                $.messager.show({
                    title: 'Error',
                    msg: result.msg
                });
            }
        }
    });
}

function back(url){
	$.get(url, {}, function(data){
		$("#center").empty();
        $("#center").html(data);
        $.parser.parse($("#center"));
    });
}

</script>
</head>
<body>
		<!-- <div class="breadcrumb">系统 &gt;&gt;组织结构管理&gt;&gt; 新增组织结构</div> -->
		<div id="org-add" 	buttons="#org-add-buttons">
			<form id="org-fm" method="post" novalidate>
<%-- 				<input type="hidden" name="pid" value="${pid} "/> --%>
				<div class="fitem">
					<label>组织结构名称：</label> 
					<input name="name"  class="easyui-validatebox" required="true" validType="length[1,20]" 
				       missingMessage="该输入项不能为空，请确认！" invalidMessage="输入范围1到20个字符，请确认！"   />
				    
				</div>
				<!--  
				<div class="fitem">
					<label>组织结构代码：</label> <input name="code"	class="easyui-validatebox" value="${org.code }">
				</div>
				<div class="fitem">
					<label><font color="red">*</font>状态：</label> <input name="status" class="easyui-validatebox" required="true" validType="length[2,200]" 
				       missingMessage="该输入项不能为空，请确认！" invalidMessage="输入范围2到200个字符，请确认！" value="${org.status }">
				</div>
 				-->
 				<div class="fitem"> 				
 					<label >上级组织：</label> 
					<select class="easyui-combotree" url="rest/comboTree.do" name="pid" style="width:300px;"/>
				</div>
				<div class="fitem">
				<label>行政区域:</label> 
				<select class="easyui-combotree" url="rest/areaComboTree.do" name="areaId" style="width:300px;"/>
			</div>
 				
			</form>
		</div>
		<div id="dlg-buttons">
			<a href="#" class="easyui-linkbutton"  iconCls="icon-ok"  onclick="saveMenu()">保存</a> 
			<a href="#" class="easyui-linkbutton"  iconCls="icon-cancel" onclick="back('org/index.do')">返回</a>
		</div>

</body>
</html>